<template>
    <div style="padding: 20px;">
        <div class="headerBoxList">
        <svg width="24" height="24" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg"><rect x="14" y="44" width="36" height="20" rx="2" transform="rotate(-90 14 44)" fill="none" stroke="#333" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"/><path d="M20 6L20 4C20 2.89543 20.8954 2 22 2L26 2C27.1046 2 28 2.89543 28 4L28 6L20 6Z" fill="#333"/><path d="M24 30V27C26.2091 27 28 24.9853 28 22.5C28 20.0147 26.2091 18 24 18C21.7909 18 20 20.0147 20 22.5" stroke="#333" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"/><path d="M26 35.5C26 36.6046 25.1046 37.5 24 37.5C22.8954 37.5 22 36.6046 22 35.5C22 34.3954 22.8954 33.5 24 33.5C25.1046 33.5 26 34.3954 26 35.5Z" fill="#333" stroke="#333"/></svg>
            <span style="margin-left: 10px">电池状态 <span style="font-size: 15px;" v-if="total!==0">({{ total }}行)</span></span>
        </div>
        <div class="content">
            <p style="border-bottom: 1px solid #ebebeb;" v-for="(item,index) in list" :key="index">· {{ item }}</p>
        </div>
    </div>
</template>
  
  <script>
  export default {
      name:'batteryStatus', 
      data(){
          return{
              list:[],
              total:0
          }
      },
      mounted(){
          this.init();
      },
      methods:{
      init(){
          let str = `Current Battery Service state:
                    AC powered: false //AC供电
                    USB powered: true //USB供电
                    Wireless powered: false //无线供电
                    Max charging current: 500000  //最大充电电流
                    Max charging voltage: 5000000  //最大充电电压
                    Charge counter: 2529879 //充电计量
                    status: 2 //2：充电 3：放电
                    health: 2
                    present: true
                    level: 91 //现在电量有xx%
                    scale: 100 //刻度
                    voltage: 4340 //电压
                    temperature: 342 //温度
                    technology: Li-ion //电池类型
                    `
          let arr = str.split("\n");
          //   console.log(arr)
          this.list = arr;
          this.total = arr.length;
      }
  
      }
  
  }
  </script>
  
  <style scoped>
    .headerBoxList {
        width: 100%;
        height: 50px;
        border-bottom: 1px solid #d2d2d2;
        display: flex;
        align-items: center;
        font-size: 18px;
        font-weight: bold;
    }
    .content{
        height: 80vh;
        overflow-y: auto;
        padding-left:50px;
        margin-top: 20px;
    }
    @media screen and (min-width: 2360px) {
      .content{
        height:67vh;
        overflow-y: auto;
      }
    }
  </style>